home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / authordate1.bst < prev    next >
Text File  |  1993-01-18  |  31KB  |  1,310 lines

  1. %  This BibTeX 0.99 style file is intended for documents that use the
  2. %  author-date citation system.  It should be used in conjunction with the
  3. %  authordate1-4.sty (or equivalent) LaTeX style-option.
  4. %
  5. %  In deciding on the bibliography layout to be implemented, the following
  6. %  works have been consulted:
  7. %  1. British Standard 5605:  "Citing publications by bibliographic
  8. %         references", 1978.
  9. %  2. British Standard 1629:  "Bibliographic references", 1976.
  10. %     (Note:  There is now a 1989 edition.)
  11. %  3. "Copy-editing" by Judith Butcher, Cambridge University Press, 1981.
  12. %  4. "The Oxford Dictionary for Writers and Editors", Oxford University
  13. %         Press, 1981 (for abbreviations).
  14. %  5. "The Chicago Manual of Style", Chicago University Press, 1982.
  15. %
  16. %  Discretion has been used in certain matters.  In particular:
  17. %  - Titles are italic except when there is a "contribution title" and
  18. %    a "main publication title", in which case the "contribution title"
  19. %    is roman while the "main publication title" is italic.
  20. %  - When there is a PUBLISHER, it is assumed that ADDRESS contains "place of
  21. %    publication";  output is of the form "place-of-publication: publisher".
  22. %    When there is an ORGANIZATION as well as a PUBLISHER, output is of the
  23. %    form "place-of-publication: publisher, for organization".  Otherwise,
  24. %    it is assumed that ADDRESS is a postal address, and output is of the
  25. %    form "institution, address", "organization, address", "school, address"
  26. %    or "howpublished, address".
  27. %  - If there is a MONTH but no VOLUME or NUMBER for a journal-article, the
  28. %    MONTH is used on the assumption that it contains information that is
  29. %    equivalent to VOLUME or NUMBER.  MONTH is ignored for other documents
  30. %    that have a PUBLISHER, but output after YEAR for anything else.
  31. %  - When CHAPTER and/or PAGES are specified with INBOOK, it is assumed that
  32. %    these fields are being used to pick out particular pages of interest
  33. %    (as an alternative to using the optional [...] argument of \cite);
  34. %    the information is put at the very end of the entry, in line with BS 1629.
  35. %    When CHAPTER and/or PAGES are specified for INCOLLECTION or INPROCEEDINGS,
  36. %    it is assumed that the fields are being used to specify the location of
  37. %    the part/article of interest; the information is put before the
  38. %    BOOKTITLE, in line with Chicago's treatment of "parts" and "chapters".
  39. %  - Since "volume" can be used in various ways (see page 219 of Butcher),
  40. %    this file assumes that, when there is a SERIES, any VOLUME and NUMBER
  41. %    refer to position in the SERIES (i.e. Butcher's meaning 4).
  42. %    If there is a VOLUME but no SERIES, it is assumed that VOLUME refers
  43. %    to a volume within a particular work (i.e. Butcher's meaning 1, 2 or 3).
  44. %    For INPROCEEDINGS and INCOLLECTION, this information goes after the
  45. %    BOOKTITLE.  (If you prefer to have volume information before EDITOR,
  46. %    as on page 449 of Chicago, you can set TYPE = "Vol." with INCOLLECTION.)
  47. %
  48. %  This file differs from authordate2.bst, authordate3.bst and authordate4.bst
  49. %  in that:
  50. %  - The titles of articles, journals and books are left in whatever
  51. %    combination of upper-case and lower-case appears in the .bib file.
  52. %  - Author's and editor's names are in roman.
  53. %
  54. %  The combination of authordate1.bst and authordate1-4.sty allows citations
  55. %  of the form \shortcite{bloggs-60} as well as the usual \cite{bloggs-60}.
  56. %  When
  57. %       ... \cite{bloggs-60} ... \shortcite{bloggs-60} ...
  58. %  appears in the input file,
  59. %       ... (Bloggs, 1960) ... (1960) ...
  60. %  appears in the final document.
  61. %
  62. %  This file was developed from apalike.bst.  It also uses code taken from
  63. %  acm.bst, aaai-named.bst, btxbst.doc, ieeetr.bst and siam.bst.
  64. %
  65. %                                                     David Rhead
  66. %                                                     Cripps Computing Centre
  67. %                                                     Nottingham University
  68. %                                                     March 1990
  69. %
  70.  
  71. ENTRY
  72.   { address
  73.     author
  74.     booktitle
  75.     chapter
  76.     edition
  77.     editor
  78.     howpublished
  79.     institution
  80.     journal
  81.     key
  82.     month
  83.     note
  84.     number
  85.     organization
  86.     pages
  87.     publisher
  88.     school
  89.     series
  90.     title
  91.     type
  92.     volume
  93.     year
  94.   }
  95.   {}
  96.   { label extra.label sort.label }
  97.  
  98. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  99.  
  100. FUNCTION {init.state.consts}
  101. { #0 'before.all :=
  102.   #1 'mid.sentence :=
  103.   #2 'after.sentence :=
  104.   #3 'after.block :=
  105. }
  106.  
  107. STRINGS { s t }
  108.  
  109. FUNCTION {output.nonnull}
  110. { 's :=
  111.   output.state mid.sentence =
  112.     { ", " * write$ }
  113.     { output.state after.block =
  114.     { add.period$ write$
  115.       newline$
  116.       "\newblock " write$
  117.     }
  118.     { output.state before.all =
  119.         'write$
  120.         { add.period$ " " * write$ }
  121.       if$
  122.     }
  123.       if$
  124.       mid.sentence 'output.state :=
  125.     }
  126.   if$
  127.   s
  128. }
  129.  
  130. FUNCTION {output}
  131. { duplicate$ empty$
  132.     'pop$
  133.     'output.nonnull
  134.   if$
  135. }
  136.  
  137. FUNCTION {output.check}
  138. { 't :=
  139.   duplicate$ empty$
  140.     { pop$ "empty " t * " in " * cite$ * warning$ }
  141.     'output.nonnull
  142.   if$
  143. }
  144.  
  145. FUNCTION {output.year.month.check}
  146. { year empty$
  147.     { "empty year in " cite$ * warning$ }
  148.     { add.period$ write$
  149.       month empty$
  150.         { " " year * extra.label * "." *
  151.           after.sentence 'output.state :=
  152.         }
  153.         { " " year * extra.label * " (" * month * ")." *
  154.           after.sentence 'output.state :=
  155.         }
  156.       if$
  157.     }
  158.   if$
  159. }
  160.  
  161. FUNCTION {output.year.check}
  162. { year empty$
  163.     { "empty year in " cite$ * warning$ }
  164.     { add.period$ write$
  165.       " " year * extra.label * "." *
  166.       after.sentence 'output.state :=
  167.     }
  168.   if$
  169. }
  170.  
  171. FUNCTION {output.bibitem}
  172. { newline$
  173.   "\bibitem[" write$
  174.   label write$
  175.   "]{" write$
  176.   cite$ write$
  177.   "}" write$
  178.   newline$
  179.   ""
  180.   before.all 'output.state :=
  181. }
  182.  
  183. FUNCTION {fin.entry}
  184. { add.period$
  185.   write$
  186.   newline$
  187. }
  188.  
  189. FUNCTION {new.block}
  190. { output.state before.all =
  191.     'skip$
  192.     { after.block 'output.state := }
  193.   if$
  194. }
  195.  
  196. FUNCTION {new.sentence}
  197. { output.state after.block =
  198.     'skip$
  199.     { output.state before.all =
  200.         'skip$
  201.         { after.sentence 'output.state := }
  202.       if$
  203.     }
  204.   if$
  205. }
  206.  
  207. FUNCTION {not}
  208. {   { #0 }
  209.     { #1 }
  210.   if$
  211. }
  212.  
  213. FUNCTION {and}
  214. {   'skip$
  215.     { pop$ #0 }
  216.   if$
  217. }
  218.  
  219. FUNCTION {or}
  220. {   { pop$ #1 }
  221.     'skip$
  222.   if$
  223. }
  224.  
  225. FUNCTION {new.block.checkb}
  226. { empty$
  227.   swap$ empty$
  228.   and
  229.     'skip$
  230.     'new.block
  231.   if$
  232. }
  233.  
  234. FUNCTION {field.or.null}
  235. { duplicate$ empty$
  236.     { pop$ "" }
  237.     'skip$
  238.   if$
  239. }
  240.  
  241. FUNCTION {boldface}
  242. { duplicate$ empty$
  243.     { pop$ "" }
  244.     { "{\bf " swap$ * "}" * }
  245.   if$
  246. }
  247.  
  248. FUNCTION {emphasize}
  249. { duplicate$ empty$
  250.     { pop$ "" }
  251.     { "{\em " swap$ * "}" * }
  252.   if$
  253. }
  254.  
  255. INTEGERS { nameptr namesleft numnames }
  256.  
  257. FUNCTION {format.names}
  258. { 's :=
  259.   #1 'nameptr :=
  260.   s num.names$ 'numnames :=
  261.   numnames 'namesleft :=
  262.     { namesleft #0 > }
  263.     { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't :=
  264.       nameptr #1 >
  265.         { namesleft #1 >
  266.             { ", " * t * }
  267.             { t "others" =
  268.                 { ", {\em et~al.\ }\relax" * }
  269.                 { ", \& " * t * }                           %  Butcher, pages
  270.               if$                                           %  186-189.
  271.             }
  272.           if$
  273.         }
  274.         't
  275.       if$
  276.       nameptr #1 + 'nameptr :=
  277.       namesleft #1 - 'namesleft :=
  278.     }
  279.   while$
  280. }
  281.  
  282. FUNCTION {format.authors}
  283. { author empty$
  284.     { "" }
  285.     { author format.names }
  286.   if$
  287. }
  288.  
  289. FUNCTION {format.key}
  290. { empty$
  291.     { key field.or.null }
  292.     { "" }
  293.   if$
  294. }
  295.  
  296. FUNCTION {format.editors}
  297. { editor empty$
  298.     { "" }
  299.     { editor format.names
  300.       editor num.names$ #1 >                                %  Use ODWE abbrevs.
  301.         { " (eds)" * }                                      %  to avoid
  302.         { " (ed)" * }                                       %  ambiguity between
  303.       if$                                                   %  "editor" and
  304.     }                                                       %  "edition".
  305.   if$
  306. }
  307.  
  308. FUNCTION {format.title}                                     %  Nothing needs
  309. { title empty$                                              %  doing here in
  310.     { "" }                                                  %  authordate1.bst
  311.     { title }                                               %  or
  312.   if$                                                       %  authordate3.bst.
  313. }
  314.  
  315. FUNCTION {n.dashify}
  316. { 't :=
  317.   ""
  318.     { t empty$ not }
  319.     { t #1 #1 substring$ "-" =
  320.         { t #1 #2 substring$ "--" = not
  321.             { "--" *
  322.               t #2 global.max$ substring$ 't :=
  323.             }
  324.             {   { t #1 #1 substring$ "-" = }
  325.                { "-" *
  326.                  t #2 global.max$ substring$ 't :=
  327.                }
  328.               while$
  329.             }
  330.           if$
  331.         }
  332.         { t #1 #1 substring$ *
  333.           t #2 global.max$ substring$ 't :=
  334.         }
  335.         if$
  336.     }
  337.   while$
  338. }
  339.  
  340. FUNCTION {format.btitle}
  341. { title empty$
  342.    { "" }                                                   %  Don't change case
  343.    { title emphasize }                                      %  in
  344.    if$                                                      %  authordate1.bst
  345. }                                                           %  or
  346.                                                             %  authordate3.bst.
  347. FUNCTION {tie.or.space.connect}
  348. { duplicate$ text.length$ #3 <
  349.     { "~" }
  350.     { " " }
  351.   if$
  352.   swap$ * *
  353. }
  354.  
  355. FUNCTION {either.or.check}
  356. { empty$
  357.     'pop$
  358.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  359.   if$
  360. }
  361.  
  362. INTEGERS { multiresult }
  363.  
  364. FUNCTION {multi.page.check}
  365. { 't :=
  366.   #0 'multiresult :=
  367.     { multiresult not
  368.       t empty$ not
  369.       and
  370.     }
  371.     { t #1 #1 substring$
  372.       duplicate$ "-" =
  373.       swap$ duplicate$ "," =
  374.       swap$ "+" =
  375.       or or
  376.         { #1 'multiresult := }
  377.         { t #2 global.max$ substring$ 't := }
  378.       if$
  379.     }
  380.   while$
  381.   multiresult
  382. }
  383.  
  384. FUNCTION {format.numberinseries}
  385. { number empty$
  386.     { "" }
  387.     { number multi.page.check
  388.         { ", nos. " number n.dashify tie.or.space.connect }
  389.         { ", no. "  number tie.or.space.connect }
  390.       if$
  391.     }
  392.   if$
  393. }
  394.  
  395. FUNCTION {booklike.series.volume.number}                    %  Chicago, pages
  396. { series empty$                                             %  450-451.
  397.     { volume empty$
  398.       { " " }
  399.       { " Vol. " volume * }
  400.       if$
  401.     }
  402.     {
  403.       volume empty$
  404.         { number empty$
  405.             { series }
  406.             { series format.numberinseries * }
  407.           if$
  408.         }
  409.         { number empty$
  410.             { series ", vol. " volume * * }
  411.             { series ", vol. " * volume * format.numberinseries * }
  412.           if$
  413.         }
  414.       if$
  415.     }
  416.   if$
  417. }
  418.  
  419. FUNCTION {incollectionlike.series.volume.number}
  420. { series empty$
  421.     { volume empty$
  422.       { " " }
  423.       { " vol. " volume * }
  424.       if$
  425.     }
  426.     { new.block
  427.       volume empty$
  428.         { number empty$
  429.             { series }
  430.             { series format.numberinseries * }
  431.           if$
  432.         }
  433.         { number empty$
  434.             { series ", vol. " volume * * }
  435.             { series ", vol. " * volume * format.numberinseries * }
  436.           if$
  437.         }
  438.       if$
  439.     }
  440.   if$
  441. }
  442.  
  443. FUNCTION {format.edition}
  444. { edition empty$
  445.     { "" }
  446.     { output.state mid.sentence =
  447.         { edition "l" change.case$ " edn." * }
  448.         { edition "t" change.case$ " edn." * }
  449.       if$
  450.     }
  451.   if$
  452. }
  453.  
  454. FUNCTION {format.pages}
  455. { pages empty$
  456.     { "" }
  457.     { pages multi.page.check
  458.         { "" pages n.dashify tie.or.space.connect }
  459.         { "" pages tie.or.space.connect }
  460.       if$
  461.     }
  462.   if$
  463. }
  464.  
  465. FUNCTION {format.pagesinbook}                               %  By the time the
  466. { pages empty$                                              %  reader has read
  467.     { "" }                                                  %  address, pub'r,
  468.     { pages multi.page.check                                %  note (where the
  469.         { "Pages " pages n.dashify tie.or.space.connect }   %  note may end with
  470.         { "Page " pages tie.or.space.connect }              %  numbers), s/he
  471.       if$                                                   %  may not recognise
  472.     }                                                       %  a number-range as
  473.   if$                                                       %  meaning pages.
  474. }                                                           %  Avoid ambiguity
  475.                                                             %  (Butcher, p.181).
  476.  
  477. FUNCTION {format.vol.num.date.pages}
  478. { volume empty$
  479.    { month empty$
  480.        { "" }
  481.        { month }
  482.      if$
  483.    }
  484.     { volume boldface field.or.null
  485.         number empty$
  486.         { month empty$
  487.             'skip$
  488.             { "(" month * ")" *  * }
  489.           if$
  490.         }
  491.         { "(" number * ")" *  *
  492.             volume empty$
  493.             { "there's a number but no volume in " cite$ * warning$ }
  494.             'skip$
  495.           if$
  496.         }
  497.       if$
  498.     }
  499.   if$
  500.   pages empty$
  501.     'skip$
  502.     { duplicate$ empty$
  503.         { pop$ format.pages }
  504.         { ", " * pages n.dashify * }
  505.       if$
  506.     }
  507.   if$
  508. }
  509.  
  510. FUNCTION {format.chapter.pages.inbook}
  511. { chapter empty$
  512.     'format.pagesinbook
  513.     { type empty$
  514.         { "Chap." }
  515.         { type }
  516.       if$
  517.       chapter tie.or.space.connect
  518.       pages empty$
  519.         'skip$
  520.         { ", " * format.pagesinbook "l" change.case$ * }
  521.       if$
  522.     }
  523.   if$
  524. }
  525.  
  526. FUNCTION {format.chapter.pages.incoll}
  527. { chapter empty$
  528.     { pages empty$
  529.         { "{\em In:} " }
  530.         { "{\em " format.pagesinbook " of:} " * * }
  531.       if$
  532.     }
  533.     { type empty$
  534.         { "{\em Chap. " chapter * }
  535.         { "{\em " type * " " * chapter * }
  536.       if$
  537.       pages empty$
  538.         { " of:} " * }
  539.         { ", " * format.pagesinbook "l" change.case$ " of:} " * * }
  540.       if$
  541.     }
  542.   if$
  543. }
  544.  
  545. FUNCTION {format.in.ed.booktitle}                           %  Achieves effect
  546. { booktitle empty$                                          %  shown in 16.51
  547.     { "" }                                                  %  of Chicago, at
  548.     { editor empty$                                         %  expense of not
  549.         { format.chapter.pages.incoll                       %  achieving effects
  550.           booktitle                  emphasize * }          %  shown in 16.50
  551.         { format.chapter.pages.incoll                       %  of Chicago, on
  552.           format.editors * ", " *                           %  page 189 of
  553.           booktitle                  emphasize * }          %  Butcher and in
  554.       if$                                                   %  4.4 of BS 1629.
  555.     }
  556.   if$                                                       %  Don't change
  557. }                                                           %  case.
  558.  
  559. FUNCTION {format.thesis.type}
  560. { type empty$
  561.     'skip$
  562.     { pop$
  563.       type                                                  %  Don't change
  564.     }                                                       %  case.
  565.   if$
  566. }
  567.  
  568. FUNCTION {format.tr.number}
  569. { type empty$
  570.     { "Tech. rept."  }                                      %  ODWE abbrevs.
  571.     'type
  572.   if$
  573.   number empty$
  574.     {                  }                                    %  Whatever was
  575.     { number tie.or.space.connect }                         %  having its case
  576.   if$                                                       %  changed, leave
  577. }                                                           %  it alone.
  578.  
  579. FUNCTION {format.addr.pub}
  580. { publisher empty$
  581.     { "" }
  582.     { address empty$
  583.         { "" }
  584.         { address ": " * }
  585.       if$
  586.       publisher *
  587.     }
  588.   if$
  589. }
  590.  
  591. FUNCTION {format.addr.pub.org}                              %  If there's an
  592. { address empty$                                            %  an organization
  593.   { publisher * ", for " * organization * }                 %  and a publisher
  594.   { address ": " * publisher * ", for " * organization * }  %  too.
  595.   if$
  596. }
  597.  
  598. FUNCTION {format.addr.inst}
  599. { address empty$
  600.   { institution empty$
  601.     { "" }
  602.     { institution }
  603.     if$
  604.   }
  605.   { institution empty$
  606.     { "" }
  607.     { institution ", " * }
  608.     if$
  609.     address *
  610.   }
  611.   if$
  612. }
  613.  
  614. FUNCTION {format.addr.org}
  615. { address empty$
  616.   { organization empty$
  617.     { "" }
  618.     { organization }
  619.     if$
  620.   }
  621.   { organization empty$
  622.     { "" }
  623.     { organization ", " * }
  624.     if$
  625.     address *
  626.   }
  627.   if$
  628. }
  629.  
  630. FUNCTION {format.article.crossref}
  631. { "{\em In:}"
  632.   " \cite{" * crossref * "}" *
  633. }
  634.  
  635. FUNCTION {format.book.crossref}
  636. { volume empty$
  637.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  638.       "{\em In:}"
  639.     }
  640.     { " Vol." volume tie.or.space.connect
  641.       " of " *
  642.     }
  643.   if$
  644.   "\cite{" * crossref * "}" *
  645. }
  646.  
  647. FUNCTION {format.incoll.inproc.crossref}
  648. { "{\em In:}"
  649.   " \cite{" * crossref * "}" *
  650. }
  651.  
  652. FUNCTION {article}
  653. { output.bibitem
  654.   format.authors "author" output.check
  655.   author format.key output
  656.   output.year.check
  657.   new.block
  658.   format.title "title" output.check
  659.   new.block
  660.   crossref missing$
  661.     { journal                  emphasize                    %  Don't change
  662.       "journal" output.check                                %  case.
  663.       format.vol.num.date.pages output
  664.     }
  665.     { format.article.crossref output.nonnull
  666.       format.pages output
  667.     }
  668.   if$
  669.   new.block
  670.   note output
  671.   fin.entry
  672. }
  673.  
  674. FUNCTION {book}
  675. { output.bibitem
  676.   author empty$
  677.     { format.editors "author and editor" output.check
  678.       editor format.key output
  679.     }
  680.     { format.authors output.nonnull
  681.       crossref missing$
  682.         { "author and editor" editor either.or.check }
  683.         'skip$
  684.       if$
  685.     }
  686.   if$
  687.   output.year.check
  688.   new.block
  689.   format.btitle "title" output.check
  690.   crossref missing$
  691.     { new.sentence
  692.       format.edition output
  693.       new.block
  694.       booklike.series.volume.number output
  695.       new.block
  696.       format.addr.pub "publisher" output.check
  697.     }
  698.     { new.block
  699.       format.book.crossref output.nonnull
  700.     }
  701.   if$
  702.   new.block
  703.   note output
  704.   fin.entry
  705. }
  706.  
  707. FUNCTION {booklet}
  708. { output.bibitem
  709.   format.authors output
  710.   author format.key output
  711.   output.year.month.check
  712.   new.block
  713.   format.btitle "title" output.check
  714.   new.block
  715.   howpublished output
  716.   address output
  717.   new.block
  718.   note output
  719.   fin.entry
  720. }
  721.  
  722. FUNCTION {inbook}
  723. { output.bibitem
  724.   author empty$
  725.     { format.editors "author and editor" output.check
  726.       editor format.key output
  727.     }
  728.     { format.authors output.nonnull
  729.       crossref missing$
  730.         { "author and editor" editor either.or.check }
  731.         'skip$
  732.       if$
  733.     }
  734.   if$
  735.   output.year.check
  736.   new.block
  737.   format.btitle "title" output.check
  738.   crossref missing$
  739.     { new.sentence
  740.       format.edition output
  741.       new.block
  742.       booklike.series.volume.number output
  743.       new.block
  744.       format.addr.pub "publisher" output.check
  745.     }
  746.     { new.block
  747.       format.book.crossref output.nonnull
  748.     }
  749.   if$
  750.   new.block
  751.   note output
  752.   new.block                                                 %  BS 1629 (rather
  753.   format.chapter.pages.inbook "chapter and pages" output.check
  754.   fin.entry                                                 %  than Chicago,
  755. }                                                           %  p. 451)
  756.  
  757. FUNCTION {incollection}
  758. { output.bibitem
  759.   author empty$
  760.     { format.editors "editor" output.check
  761.       editor format.key output             }
  762.     { format.authors "author" output.check
  763.       author format.key output             }
  764.   if$
  765.   output.year.check
  766.   new.block
  767.   format.title "title" output.check
  768.   new.block
  769.   crossref missing$                                         %  Chapter and/or
  770.     { format.in.ed.booktitle output                         %  page numbers can
  771.       format.edition output                                 %  come out via this
  772.       incollectionlike.series.volume.number output          %  route, too.
  773.       new.block
  774.       format.addr.pub "publisher" output.check
  775.     }
  776.     { format.incoll.inproc.crossref output.nonnull
  777.       new.block
  778.     }
  779.   if$
  780.   new.block
  781.   note output
  782.   fin.entry
  783. }
  784.  
  785. FUNCTION {inproceedings}
  786. { output.bibitem
  787.   format.authors "author" output.check
  788.   author format.key output
  789.   publisher empty$
  790.     { output.year.month.check }
  791.     { output.year.check }
  792.   if$
  793.   new.block
  794.   format.title "title" output.check
  795.   new.block
  796.   crossref missing$
  797.     { format.in.ed.booktitle "booktitle" output.check
  798.       incollectionlike.series.volume.number output
  799.       new.block
  800.       publisher empty$
  801.       {
  802.         organization empty$
  803.         'skip$
  804.         { format.addr.org output }
  805.         if$
  806.       }
  807.       {
  808.         organization empty$
  809.         { format.addr.pub output }
  810.         { format.addr.pub.org output }
  811.         if$
  812.       }
  813.       if$
  814.     }
  815.     { format.incoll.inproc.crossref output.nonnull
  816.     }
  817.   if$
  818.   new.block
  819.   note output
  820.   fin.entry
  821. }
  822.  
  823. FUNCTION {conference} { inproceedings }
  824.  
  825. FUNCTION {manual}
  826. { output.bibitem
  827.   format.authors output
  828.   author format.key output
  829.   output.year.month.check
  830.   new.block
  831.   format.btitle "title" output.check
  832.   new.sentence
  833.   format.edition output
  834.   new.block
  835.   organization address new.block.checkb
  836.   format.addr.org output
  837.   new.block
  838.   note output
  839.   fin.entry
  840. }
  841.  
  842. FUNCTION {mastersthesis}
  843. { output.bibitem
  844.   format.authors "author" output.check
  845.   author format.key output
  846.   output.year.month.check
  847.   new.block
  848.   format.btitle "title" output.check
  849.   new.block
  850.   "M.Phil. thesis" format.thesis.type output.nonnull        %  ODWE abbrev.
  851.   school "school" output.check
  852.   address output
  853.   new.block
  854.   note output
  855.   fin.entry
  856. }
  857.  
  858. FUNCTION {misc}
  859. { output.bibitem
  860.   format.authors output
  861.   author format.key output
  862.   output.year.month.check
  863.   new.block
  864.   format.btitle output
  865.   new.block
  866.   howpublished output
  867.   new.block
  868.   note output
  869.   fin.entry
  870. }
  871.  
  872. FUNCTION {phdthesis}
  873. { output.bibitem
  874.   format.authors "author" output.check
  875.   author format.key output
  876.   output.year.month.check
  877.   new.block
  878.   format.btitle "title" output.check
  879.   new.block
  880.   "Ph.D. thesis" format.thesis.type output.nonnull          %  Butcher,
  881.   school "school" output.check                              %  page 174.
  882.   address output
  883.   new.block
  884.   note output
  885.   fin.entry
  886. }
  887.  
  888. FUNCTION {proceedings}
  889. { output.bibitem
  890.   format.editors "author and editor" output.check
  891.   editor format.key output
  892.   publisher empty$
  893.     { output.year.month.check }
  894.     { output.year.check }
  895.   if$
  896.   new.block
  897.   format.btitle "title" output.check
  898.   new.block
  899.   booklike.series.volume.number output
  900.       new.block
  901.       publisher empty$
  902.       {
  903.         organization empty$
  904.         'skip$
  905.         { format.addr.org output }
  906.         if$
  907.       }
  908.       {
  909.         organization empty$
  910.         { format.addr.pub output }
  911.         { format.addr.pub.org output }
  912.         if$
  913.       }
  914.       if$
  915.   new.block
  916.   note output
  917.   fin.entry
  918. }
  919.  
  920. FUNCTION {techreport}
  921. { output.bibitem
  922.   format.authors "author" output.check
  923.   author format.key output
  924.   output.year.month.check
  925.   new.block
  926.   format.btitle "title" output.check
  927.   new.block
  928.   format.tr.number output.nonnull
  929.   new.sentence
  930.   format.addr.inst "institution" output.check
  931.   new.block
  932.   note output
  933.   fin.entry
  934. }
  935.  
  936. FUNCTION {unpublished}
  937. { output.bibitem
  938.   format.authors "author" output.check
  939.   author format.key output
  940.   output.year.month.check
  941.   new.block
  942.   format.btitle "title" output.check
  943.   new.block
  944.   note "note" output.check
  945.   fin.entry
  946. }
  947.  
  948. FUNCTION {default.type} { misc }
  949.  
  950. MACRO {jan} {"Jan."}                                        %  ODWE, "months", &
  951.                                                             %  Chicago, p. 383.
  952. MACRO {feb} {"Feb."}
  953.  
  954. MACRO {mar} {"Mar."}
  955.  
  956. MACRO {apr} {"Apr."}
  957.  
  958. MACRO {may} {"May"}
  959.  
  960. MACRO {jun} {"June"}
  961.  
  962. MACRO {jul} {"July"}
  963.  
  964. MACRO {aug} {"Aug."}
  965.  
  966. MACRO {sep} {"Sept."}
  967.  
  968. MACRO {oct} {"Oct."}
  969.  
  970. MACRO {nov} {"Nov."}
  971.  
  972. MACRO {dec} {"Dec."}
  973.  
  974. MACRO {acmcs} {"ACM Computing Surveys"}
  975.  
  976. MACRO {acta} {"Acta Informatica"}
  977.  
  978. MACRO {cacm} {"Communications of the ACM"}
  979.  
  980. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  981.  
  982. MACRO {ibmsj} {"IBM Systems Journal"}
  983.  
  984. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  985.  
  986. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  987.  
  988. MACRO {ieeetcad}
  989.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  990.  
  991. MACRO {ipl} {"Information Processing Letters"}
  992.  
  993. MACRO {jacm} {"Journal of the ACM"}
  994.  
  995. MACRO {jcss} {"Journal of Computer and System Sciences"}
  996.  
  997. MACRO {scp} {"Science of Computer Programming"}
  998.  
  999. MACRO {sicomp} {"SIAM Journal on Computing"}
  1000.  
  1001. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1002.  
  1003. MACRO {tods} {"ACM Transactions on Database Systems"}
  1004.  
  1005. MACRO {tog} {"ACM Transactions on Graphics"}
  1006.  
  1007. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1008.  
  1009. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1010.  
  1011. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1012.  
  1013. MACRO {tcs} {"Theoretical Computer Science"}
  1014.  
  1015. READ
  1016.  
  1017. FUNCTION {sortify}
  1018. { purify$
  1019.   "l" change.case$
  1020. }
  1021.  
  1022. INTEGERS { len }
  1023.  
  1024. FUNCTION {chop.word}
  1025. { 's :=
  1026.   'len :=
  1027.   s #1 len substring$ =
  1028.     { s len #1 + global.max$ substring$ }
  1029.     's
  1030.   if$
  1031. }
  1032.  
  1033. FUNCTION {format.lab.names}
  1034. { 's :=
  1035.   s #1 "{vv~}{ll}" format.name$
  1036.   s num.names$ duplicate$
  1037.   #2 >
  1038.     { pop$ " {\em et~al.\ }\relax" * }
  1039.     { #2 <
  1040.         'skip$
  1041.         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1042.             { " {\em et~al.\ }\relax" * }
  1043.             { " \& " * s #2 "{vv~}{ll}" format.name$ * }
  1044.           if$
  1045.         }
  1046.       if$
  1047.     }
  1048.   if$
  1049. }
  1050.  
  1051. FUNCTION {author.key.label}
  1052. { author empty$
  1053.     { key empty$
  1054.         { cite$ #1 #3 substring$ }
  1055.         'key
  1056.       if$
  1057.     }
  1058.     { author format.lab.names }
  1059.   if$
  1060. }
  1061.  
  1062. FUNCTION {author.editor.key.label}
  1063. { author empty$
  1064.     { editor empty$
  1065.         { key empty$
  1066.             { cite$ #1 #3 substring$ }
  1067.             'key
  1068.           if$
  1069.         }
  1070.         { editor format.lab.names }
  1071.       if$
  1072.     }
  1073.     { author format.lab.names }
  1074.   if$
  1075. }
  1076.  
  1077. FUNCTION {editor.key.label}
  1078. { editor empty$
  1079.     { key empty$
  1080.         { cite$ #1 #3 substring$ }
  1081.         'key
  1082.       if$
  1083.     }
  1084.     { editor format.lab.names }
  1085.   if$
  1086. }
  1087.  
  1088. FUNCTION {calc.label}
  1089.   { type$ "book" =
  1090.     type$ "inbook" =
  1091.     type$ "incollection" =                                  %  For sensible
  1092.   or or                                                     %  treatment of
  1093.     'author.editor.key.label                                %  Singer in
  1094.     { type$ "proceedings" =                                 %  BS 1629.
  1095.         'editor.key.label
  1096.         'author.key.label
  1097.       if$
  1098.     }
  1099.   if$
  1100.   duplicate$
  1101.   year empty$
  1102.   {
  1103.     "\protect\citename{" swap$ * ", }" *
  1104.     "n.d." * 'label :=                                      %  Chicago,
  1105.   }                                                         %  page 457.
  1106.   {
  1107.     "\protect\citename{" swap$ * ", }" *
  1108.     year
  1109.     *
  1110.     'label :=
  1111.   }
  1112.   if$
  1113.   year field.or.null purify$ *
  1114.   sortify 'sort.label :=
  1115. }
  1116.  
  1117.  
  1118. FUNCTION {sort.format.names}                                %  To produce the
  1119. { 's :=                                                     %  order of entries
  1120.   #1 'nameptr :=                                            %  specified in item
  1121.   ""                                                        %  (3) on page 187
  1122.   s num.names$ 'numnames :=                                 %  of Butcher.
  1123.   numnames 'namesleft :=
  1124.     { namesleft #0 > nameptr #3 < and }                     %  Only 1st 2 names
  1125.     { nameptr #1 >                                          %  matter for
  1126.         { "   " * }                                         %  sorting.
  1127.         'skip$
  1128.       if$                                                   %  Anything that's
  1129.       nameptr #2 = numnames #2 > and                        %  "et al" goes
  1130.       { "zzzzz" * }                                         %  after works by 2
  1131.       {                                                     %  authors.
  1132.         s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1133.         nameptr numnames = t "others" = and
  1134.           { "zzzzz" * }
  1135.           { t sortify * }
  1136.         if$
  1137.       }
  1138.       if$
  1139.       nameptr #1 + 'nameptr :=
  1140.       namesleft #1 - 'namesleft :=
  1141.     }
  1142.   while$
  1143. }
  1144.  
  1145. FUNCTION {sort.format.title}
  1146. { 't :=
  1147.   "A " #2
  1148.     "An " #3
  1149.       "The " #4 t chop.word
  1150.     chop.word
  1151.   chop.word
  1152.   sortify
  1153.   #1 global.max$ substring$
  1154. }
  1155.  
  1156. FUNCTION {author.sort}
  1157. { author empty$
  1158.     { key empty$
  1159.         { "to sort, need author or key in " cite$ * warning$
  1160.           ""
  1161.         }
  1162.         { key sortify }
  1163.       if$
  1164.     }
  1165.     { author sort.format.names }
  1166.   if$
  1167. }
  1168.  
  1169. FUNCTION {author.editor.sort}
  1170. { author empty$
  1171.     { editor empty$
  1172.         { key empty$
  1173.             { "to sort, need author, editor, or key in " cite$ * warning$
  1174.               ""
  1175.             }
  1176.             { key sortify }
  1177.           if$
  1178.         }
  1179.         { editor sort.format.names }
  1180.       if$
  1181.     }
  1182.     { author sort.format.names }
  1183.   if$
  1184. }
  1185.  
  1186. FUNCTION {editor.sort}
  1187. { editor empty$
  1188.     { key empty$
  1189.         { "to sort, need editor or key in " cite$ * warning$
  1190.           ""
  1191.         }
  1192.         { key sortify }
  1193.       if$
  1194.     }
  1195.     { editor sort.format.names }
  1196.   if$
  1197. }
  1198.  
  1199. FUNCTION {presort}                                          %  Two sorting
  1200. { calc.label                                                %  passes, from
  1201.   label sortify                                             %  apalike.bst.
  1202.   "    "
  1203.   *
  1204.   type$ "book" =
  1205.   type$ "inbook" =
  1206.   type$ "incollection" =                                    %  For Singer
  1207.   or or                                                     %  in BS 1629.
  1208.     'author.editor.sort
  1209.     { type$ "proceedings" =
  1210.         'editor.sort
  1211.         'author.sort
  1212.       if$
  1213.     }
  1214.   if$
  1215.   #1 entry.max$ substring$
  1216.   'sort.label :=
  1217.   sort.label
  1218.   *
  1219.   "    "
  1220.   *
  1221.   title field.or.null
  1222.   sort.format.title
  1223.   *
  1224.   #1 entry.max$ substring$
  1225.   'sort.key$ :=
  1226. }
  1227.  
  1228. ITERATE {presort}
  1229.  
  1230. SORT
  1231.  
  1232. STRINGS { last.label next.extra }
  1233.  
  1234. INTEGERS { last.extra.num }
  1235.  
  1236. FUNCTION {initialize.extra.label.stuff}
  1237. { #0 int.to.chr$ 'last.label :=
  1238.   "" 'next.extra :=
  1239.   #0 'last.extra.num :=
  1240. }
  1241.  
  1242. FUNCTION {forward.pass}
  1243. { last.label label =
  1244.     { last.extra.num #1 + 'last.extra.num :=
  1245.       last.extra.num int.to.chr$ 'extra.label :=
  1246.     }
  1247.     { "a" chr.to.int$ 'last.extra.num :=
  1248.       "" 'extra.label :=
  1249.       label 'last.label :=
  1250.     }
  1251.   if$
  1252. }
  1253.  
  1254. FUNCTION {reverse.pass}
  1255. { next.extra "b" =
  1256.     { "a" 'extra.label := }
  1257.     'skip$
  1258.   if$                                                       %  Code needed here
  1259.                                                             %  if \citeauthor
  1260.                                                             %  and \citeyear
  1261.   label extra.label * 'label :=                             %  were supported.
  1262.   extra.label 'next.extra :=
  1263. }
  1264.  
  1265. EXECUTE {initialize.extra.label.stuff}
  1266.  
  1267. ITERATE {forward.pass}
  1268.  
  1269. REVERSE {reverse.pass}
  1270.  
  1271. FUNCTION {bib.sort.order}
  1272. { sort.label
  1273.   "    "
  1274.   *
  1275.   year field.or.null sortify
  1276.   *
  1277.   "    "
  1278.   *
  1279.   title field.or.null
  1280.   sort.format.title
  1281.   *
  1282.   #1 entry.max$ substring$
  1283.   'sort.key$ :=
  1284. }
  1285.  
  1286. ITERATE {bib.sort.order}
  1287.  
  1288. SORT
  1289.  
  1290. FUNCTION {begin.bib}
  1291. { preamble$ empty$
  1292.     'skip$
  1293.     { preamble$ write$ newline$ }
  1294.   if$
  1295.   "\begin{thebibliography}{}" write$ newline$
  1296. }
  1297.  
  1298. EXECUTE {begin.bib}
  1299.  
  1300. EXECUTE {init.state.consts}
  1301.  
  1302. ITERATE {call.type$}
  1303.  
  1304. FUNCTION {end.bib}
  1305. { newline$
  1306.   "\end{thebibliography}" write$ newline$
  1307. }
  1308.  
  1309. EXECUTE {end.bib}
  1310.